{% extends 'base.html' %}
{% load staticfiles %}
{% block extra_head %}
    <link rel="stylesheet" href="{% static 'movie/css/most_reviews.css' %}">
        {% endblock %}
{% block navbar %}
    <div class="page-header">
        <div class="movie-if">
            <h2><a href="{{ movie.get_absolute_url }}">{{ movie.title }} </a>的影评</h2>
            <h4>({{ movie.review_set.count }})</h4>
        </div>
        <div class="post-action" >
            <a href="{% url 'post:post_review' mid=movie.id %}">写影评</a>
        </div>
    </div>
{% endblock %}

{% block content %}
    <div class="wrapper">
        <div class="review-list">
            {% for review in reviews.object_list %}
                <div class="review-item">
                    <header class="r-hd">
                        <a href="{% url 'auser:homepage' review.user.id %}" class="avatar">
                            <img src="" alt="##">
                        </a>
                        <a href="{% url 'auser:homepage' review.user.id %}" class="name">
                            {{ review.user.username }}
                        </a>
                        <span class="date">{{ review.timestamp|date:"Y-m-d" }}</span>
                    </header>
                    <div class="r-bd">
                        <h3><a href="{% url 'post:review_detail' review.id %}">{{ review.title }}</a></h3>
                        <div class="review-short" id="review_{{ review.id }}_short">
                            <div class="short-content">
                                {% autoescape off %}
                                {{ review.body|truncatechars_html:30 }}..
                                {% endautoescape %}
                                <a href="javascript:void(0)" id="toggle-{{ review.id }}-copy"
                                   class="unfold" title="展开">展开</a>
                            </div>
                        </div>
                        <div class="hidden" id="review_{{ review.id }}_full">
                            <div id="review_{{ review.id }}_full_content" class="full-content">
                                <div class="main-bd">
                                    {% autoescape off %}
                                        {{ review.body }}
                                    {% endautoescape %}
                                </div>
                            </div>
                        </div>
                        <div class="action" style="width: 675px;left: 431.5px;">
                            <a href="javascript:void(0)" class="fold hidden"
                               style="background-color: rgb(225, 230, 215);">收起</a>
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
        <br><br><br>
    <ul class="paginator" style="position: relative; text-align: center">
        {% if reviews.has_previous %}
            <a href="{% url 'movie:movie_reviews' movie.id reviews.previous_page_number %}">上一页</a>
        {% endif %}
{#        {% for number in reviews.number %}#}
{#            {% if number == reviews.number %}#}
{#                <a href="{% url 'movie:movie_reviews' movie.id reviews.previous_page_number %}" style="font-size: 33px">{{ number }}</a>#}
{#            {% else %}#}
{#                <a href="{% url 'movie:movie_reviews' movie.id reviews.previous_page_number %}">{{ number }}</a>#}
{#            {% endif %}#}
{#        {% endfor %}#}
        {% if reviews.has_next %}
            <a href="{% url 'movie:movie_reviews' movie.id reviews.next_page_number %}">下一页</a>
        {% endif %}
        {# 当前的页面的序号  num_pages:总页数#}
        <span>{{ reviews.number }}/{{ reviews.paginator.num_pages }}</span>
    </ul>
    </div>
{% endblock %}
{% block script %}
    <script type="text/javascript" src="{% static 'movie/js/_most_review.js' %}"></script>

{% endblock %}